<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <script type="text/javascript" src="lib/js/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="lib/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="lib/js/js.cookie.min.js"></script>
    <link rel="stylesheet" href="lib/css/bootstrap.min.css">
</head>
<body style="background: #eeeeee">
<div class="container" style="margin-top: 200px">

    <div class="col-xs-4 col-xs-offset-4" >

        <form action="login" method="post" class="form-signin">

            <div class="form-group">
                <label></label> <input type="text" name="userName" id="userName"
                                       class="form-control" placeholder="请输入用户名">
            </div>
            <div class="form-group">
                <label></label> <input type="password" name="pwd" id="pwd"
                                       class="form-control" placeholder="请输入密码">
            </div>

            <div class="form-group">
                <label></label>
                <button id="login" type="button" class="btn btn-info" style="width: 100%">登录</button>
            </div>
            <a href="register.html">注册</a>


        </form>
    </div>

</div>
</body>
</html>
<script type="application/javascript">
    $("#login").click(function () {
        $.ajax({
            url: '/libms/sigin',
            type: 'post',
            dataType: 'json',
            data: {
                uname: $("#userName").val(),
                pwd: $("#pwd").val(),

            },
        })
        .done(function(e ) {
            if (e.code == 1) {
                Cookies.set("user",e.model);
                window.location.href = "/libms/index.html";

            } else {
                alert(e.msg);
            }
            console.log("success");
        })
        .fail(function() {
            console.log("error");
        })
        .always(function() {
            console.log("complete");
        });
        
    })
</script> 